DEF_PROJECT=../../..
include $(DEF_PROJECT)/scripts/main.mk
name=e2fsprogs
version=1.42.5
deps=util-linux
build=$(name)-build
prefix=/usr
destdir=$(DIR_SYSROOT)
extdeps=eglibc-tools gcc-tools binutils-tools linux-header-tools

DL_SERV=http
DL_HOST=www.kernel.org
DL_PATH=/pub/linux/kernel/people/tytso/$(name)/v$(version)
DL_SUFFIX=tar.bz2

CFLAGS+=-I$(destdir)/usr/include

LDFLAGS+=-L$(destdir)/usr/lib -lblkid -luuid

cdefs+=PKG_CONFIG=true

cflags+=--host=$(CC_TARGET)
cflags+=--build=$(CC_HOST)
cflags+=--with-root-prefix=""
cflags+=--enable-elf-shlibs
cflags+=--disable-libblkid
cflags+=--disable-libuuid
cflags+=--disable-fsck
cflags+=--disable-uuidd

iflags=LDCONFIG= $(if $(destdir),DESTDIR=$(destdir)) $(if $(DESTDIR),DESTDIR=$(DESTDIR))

post-build:
	$(MAKE) -C $(if $(build),$(build),$(source)) install $(iflags)
	$(MAKE) -C $(if $(build),$(build),$(source)) install-libs $(iflags)
	rm $(destdir)/usr/lib/lib{com_err,e2p,ext2fs,ss}.so
	ln -sf ../../lib/libcom_err.so.2 $(destdir)/usr/lib/libcom_err.so
	ln -sf ../../lib/libe2p.so.2 $(destdir)/usr/lib/libe2p.so
	ln -sf ../../lib/libext2fs.so.2 $(destdir)/usr/lib/libext2fs.so
	ln -sf ../../lib/libss.so.2 $(destdir)/usr/lib/libss.so
